/**
 * 单点登录
 * @author luguoxiang
 * @date 2024/03/17
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
import { notEmpty, request } from '@/soar';

/**
 * 获取ticket
 */
export function getTicket() {
  return request.get('/system/sso-apply/ticket');
}

/**
 * 跳转到子系统
 * @param path
 */
export function toClient(path: string) {
  notEmpty(path, '请填写跳转地址');
  getTicket().then((res) => {
    path = `${path}${path.includes('?') ? '&' : '?'}ticket=${res}`;
    window.location.href = path;
  });
}
